package com.project.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.common.validate.add;
import com.common.validate.edit;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.framework.config.BigDecimalSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;


/**
 * 预算科目对象 dm_budget_subject
 * 
 * @author baige
 * @date 2025-02-08
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("预算科目")
public class DmBudgetSubject  extends TimeUserEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键ID")
    @TableId(value = "id",type= IdType.ASSIGN_UUID)
    private String id;


    @ApiModelProperty("预算标准id -外键")
    private String standardId;


    @ApiModelProperty("预算标准id -外键")
    @NotBlank(message = "预算科目编号不能为空", groups = {add.class, edit.class})
    private String code;

    @ApiModelProperty("预算科目名称")
    @NotBlank(message = "预算科目名称不能为空", groups = {add.class, edit.class})
    private String name;

    /** 排序号 */
    private Long orderId;


    @ApiModelProperty("预算填写说明")
    private String note;

    /** 配套可超比例(%) */
    private BigDecimal matchingFundLimitScope;

    /** 专项可超比例(%) */
    private BigDecimal specialFundLimitScope;


    @ApiModelProperty("上级code")
    private String upCode ="";


    @ApiModelProperty("科目层级")
    private Integer subjectLevel;


    @ApiModelProperty("经费调整限制")
    private String feeLimit;


    private String nameLocal;

    @ApiModelProperty("是否有子科目")
    @TableField("hasChildren")
    private int hasChildren;

    @TableField(exist = false)
    private List<DmBudgetSubject> children;

    /** 项目预算需要的一些字段 **/
    @TableField(exist = false)
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal feeRatio = new BigDecimal(0);

    @ApiModelProperty("预算批次id")
    @TableField(exist = false)
    private String batchId;

    @ApiModelProperty("专项经费")
    @TableField(exist = false)
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal zxMoney = new BigDecimal(0);

    @ApiModelProperty("配套经费")
    @TableField(exist = false)
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal ptMoney = new BigDecimal(0);

    @ApiModelProperty("留校经费")
    @TableField(exist = false)
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal lxMoney = new BigDecimal(0);

    @ApiModelProperty("外拨经费")
    @TableField(exist = false)
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal wbMoney = new BigDecimal(0);

    @ApiModelProperty("自筹经费")
    @TableField(exist = false)
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal zcMoney = new BigDecimal(0);

    @ApiModelProperty("横向经费")
    @TableField(exist = false)
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal yfFee = new BigDecimal(0);

    /** 预算变更的一些字段 **/
    @ApiModelProperty("变更主表id")
    @TableField(exist = false)
    private String alterId;

    @ApiModelProperty("预算类型")
    @TableField(exist = false)
    private String budgetType;

    @ApiModelProperty("变更量")
    @TableField(exist = false)
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal budgetFeeChange = new BigDecimal(0);

    @ApiModelProperty("变更前")
    @TableField(exist = false)
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal beforeAlterBudgetFee = new BigDecimal(0);

    @ApiModelProperty("变更时间")
    @TableField(exist = false)
    private String changeTime;

    @ApiModelProperty("变更后")
    @TableField(exist = false)
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal afterAlterBudgetFee = new BigDecimal(0);

    /** 预算变更历史的一些字段 **/
    @ApiModelProperty("初始值")
    @TableField(exist = false)
    private String initVal = "0";

    @ApiModelProperty("变更量历史")
    @TableField(exist = false)
    private String changeMoneyHis = "0";

    @ApiModelProperty("变更时间历史")
    @TableField(exist = false)
    private String changeTimeHis = "";
}
